#ifndef CPPN_NEURON_HH
#define CPPN_NEURON_HH

#include <functional>
#include <vector>
#include <utility>

#include "evolution/gene.hh"
#include "ann/node.hh"
#include "ann/connection.hh"

namespace cppn {
    class Node;

    class Connection final : public ann::Connection {
        Node const* src;
        const float weight;
    public:
        Connection (Node const* src, float weight) : src(src), weight(weight) { }

        ann::Node const* get_source() const override;
        float get_weight() const override { return weight; }
    };

    class Node final : public ann::Node {
        int id;
        evolution::NodeType type;
        
        float bias;
        std::vector<Connection> inputs;

    public:
        Node (evolution::NodeGene const& gene);

        ann::Connection const* get_input (size_t i) const override { return &inputs[i]; }
        size_t count_connections() const override { return inputs.size(); }
        int get_type() const override { return int(type); }
        float get_bias() const override { return bias; }

        int get_id() const { return id; }


        void connect_from (Node* src, float weight);
        void connect_to (Node* dst, float weight);

        //std::vector<std::pair<Node*, float>> get_inputs() const { return inputs; }
        static float activation (int type, float input, float bias);
    };

}

#endif










